package com.ucode.model.cgms.form;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.hibernate.validator.constraints.Range;
import javax.validation.constraints.*;
import java.math.BigDecimal;
import java.util.List;
import java.util.Set;

@Schema(description = "陪玩俱乐部社区系统 - 陪玩商品Form")
@Data
@EqualsAndHashCode
@ToString(callSuper = true)
public class CgmsCompanionProductForm {
    /**
     * 服务提供者，如果为0L,官方提供，则需要触发抢单服务
     */
    @Schema(description = "服务提供者ID", requiredMode = Schema.RequiredMode.AUTO)
    private Long memberId;
    /**
     * 专区ID
     */
    @Schema(description = "专区", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotNull(message = "专区不能为空")
    private Long zoneId;
    /**
     * 商品分类
     */
    @Schema(description = "商品分类", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotNull(message = "商品分类不能为空")
    private Long categoryId;

    /**
     * 商品标题
     */
    @Schema(description = "商品标题", example = "张三", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotBlank(message = "商品标题不能为空")
    @Size(max = 100, message = "商品标题不能超过100个字符")
    private String title;
    /**
     * 子标题（可以简述段位、价格等）
     */
    @Schema(description = "子标题", example = "张三", requiredMode = Schema.RequiredMode.AUTO)
    @Size(max = 200, message = "子标题不能超过200个字符")
    private String subTitle;
    /**
     * 商品列表图
     */
    @Schema(description = "商品列表图", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotBlank(message = "商品列表图不能为空")
    @Size(max = 255, message = "商品列表图不能超过 255 个字符")
    private String picUrl;
    /**
     * 商品海报图
     */
    @Schema(description = "商品海报图", requiredMode = Schema.RequiredMode.AUTO)
    @Size(max = 255, message = "商品海报图不能超过 255 个字符")
    private String posterPicUrl;
    /**
     * 海报标题
     */
    @Schema(description = "海报标题", requiredMode = Schema.RequiredMode.AUTO)
    @Size(max = 100, message = "海报标题不能超过 100 个字符")
    private String posterTitle;
    /**
     * 商品轮播图(最多6张)
     * 1. 第一张图片将作为商品主图，支持同时上传多张图；
     * 2. 建议使用尺寸 800x800 像素以上、大小不超过 1M 的正方形图片；
     * 3. 至少 1 张，最多上传 6 张
     */
    @Schema(description = "商品轮播图", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotEmpty(message = "商品轮播图不能为空")
    @Size(min = 1,max = 6, message = "商品轮播图不能少于 1 张，最多上传 6 张")
    private List<String> carouselPicUrls;
    /**
     * 描述
     */
    @Schema(description = "服务简述", example = "张三", requiredMode = Schema.RequiredMode.AUTO)
    @Size(max = 1024, message = "服务简述不能超过 1024 个字符")
    private String description;
    /**
     * 市场价,单位:元
     */
    @Schema(description = "市场价（单位：元）", requiredMode = Schema.RequiredMode.AUTO)
    @DecimalMin(value = "0",message = "市场价最小值为 0")
    @Digits(integer = 10,fraction = 2,message = "市场价格式不正确")
    private BigDecimal marketPrice;
    /**
     * 现价,单位:元
     */
    @Schema(description = "现价（单位：元）", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotNull(message = "现价不能为空")
    @DecimalMin(value = "0",message = "现价最小值为 0")
    @Digits(integer = 10,fraction = 2,message = "现价格式不正确")
    private BigDecimal price;
    /**
     * 单位
     */
    @Schema(description = "单位", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotBlank(message = "单位不能为空")
    @Size(max = 20, message = "单位不能超过 20 个字符")
    private String unitStr;
    /**
     * 是否启用限购
     */
    @Schema(description = "是否启用限购", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotNull(message = "是否启用限购不能为空")
    private Boolean useLimit;
    /**
     * 限购类型
     * 1:单次限购 是限制每次下单最多购买的数量，
     * 2:单人限购 是限制一个用户总共可以购买的数量
     * 3:单日限购 是限制一个用户每天可以购买的数量
     */
    @Schema(description = "标签", requiredMode = Schema.RequiredMode.AUTO)
    @Range(min = 1,max = 3,message = "限购类型范围在 1 到 3 之间")
    private Integer limitType;
    /**
     * 限购数量
     */
    @Schema(description = "标签", requiredMode = Schema.RequiredMode.AUTO)
    @Min(value = 1,message = "限购数量最小值为 1")
    private Integer limitQty;
    /**
     * 标签
     */
    @Schema(description = "标签", requiredMode = Schema.RequiredMode.AUTO)
    @Size(max = 10, message = "标签不能超过 10 个")
    private Set<String> tags;

    /**
     * 是否新品
     */
    @Schema(description = "是否新品", requiredMode = Schema.RequiredMode.AUTO)
    private Boolean recNew = false;
    /**
     * 是否热卖
     */
    @Schema(description = "是否热卖", requiredMode = Schema.RequiredMode.AUTO)
    private Boolean recHot = false;
    /**
     * 是否促销
     */
    @Schema(description = "是否促销", requiredMode = Schema.RequiredMode.AUTO)
    private Boolean recBenefit = false;

    /**
     * 是否立即上架
     */
    @Schema(description = "是否立即上架", requiredMode = Schema.RequiredMode.AUTO)
    private Boolean onSale = false;


    /**
     * 抽成比例时为百分比
     */
    //@NotNull(message = "抽成比例时为百分比不能为空")
    @DecimalMin(value = "0",message = "抽成比例时为百分比最小值为 0")
    @Digits(integer = 2,fraction = 2,message = "抽成比例时为百分比参数值格式不正确")
    private BigDecimal commissionRatio;

    /**
     * 返点比例时为百分比
     */
    //@NotNull(message = "返点比例时为百分比不能为空")
    @DecimalMin(value = "0",message = "返点比例时为百分比最小值为 0")
    @Digits(integer = 2,fraction = 2,message = "返点比例时为百分比参数值格式不正确")
    private BigDecimal rebateRatio;

    /**
     * 销售量
     */
    private Integer salesCount;

    /**
     * 排序
     */
    private Integer sortnum;

}
